home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 05.zip
/
BS1 part 5
/
PDraw3.0.adf
/
pdraw_rex.lzh
/
StyleTagAdd.pdrx
< prev
next >
Wrap
Text File
|
1992-06-15
|
3KB
|
150 lines
/*
@N
@LThis Genie will add a set of object attributes to a Styles database on disk.
The Attributes may come from the current settings or from settings specified by the user
*/
msg = PDSetup.rexx(2,0)
units = getclip(pds_units)
if msg ~= 1 then exit_msg(msg)
cr = '0a'x
styledb = "S:PDStyles.db"
delimiter = "**********"
/* initialize variables */
linecolor = ''
lineweight = ''
linepattern = ''
linejoin = ''
FillPattern = ''
attributes.1 = "LineColor"
attributes.1.1 = "_Line Color"
attributes.2 = "LineWeight"
attributes.2.1 = "_Line Weight"
attributes.3 = "LinePattern"
attributes.3.1 = "_Line Pattern"
attributes.4 = "LineJoin"
attributes.4.1 = "_Line Join"
attributes.5 = "FillPattern"
attributes.5.1 = "_Fill Pattern"
attr = ''
do i = 1 to 5
attr = attr || cr || attributes.i.1
interpret compress(attributes.i.1)"=" i
end
attr = substr(attr, 2)
attr = pdm_SelectFromList("Select Style Attributes..", 25, 5, 1, attr)
if attr = '' then exit_msg()
do while attr ~= ''
parse var attr attribute '0a'x attr
i = value(compress("_"attribute))
attribute = attributes.i
interpret attribute" = pdm_Get"attribute"()"
if attribute = "FillPattern" then
do
parse var fillpattern gradtype '0a'x color1 '0a'x color2 '0a'x steps '0a'x angle '0a'x centerx '0a'x centery
cdef1 = separate(pdm_GetColorData(color1), ',')
cdef2 = separate(pdm_GetColorData(color2), ',')
fillpattern = gradtype';'cdef1';'color1';'cdef2';'color2';'steps';'angle';'centerx';'centery';'
end
else if attribute = "LineColor" then
do
cdef = separate(pdm_GetColorData(linecolor), ',')
linecolor = linecolor';'cdef';'
end
end
start:
/* ask use for the name of new style and write it to the database */
stylename = pdm_GetForm("Enter name of style..", 30, "Name")
if stylename = '' then exit_msg()
lines = ''
if ~exists(styledb) then signal past
if ~open(file, styledb, "r") then
exit_msg("Unable to open styletag database!!")
call pdm_ShowStatus("Reading style database..")
/* read through entrys to make sure style is not already declared */
ustylename = upper(stylename)
do while ~eof(file)
line = strip(readln(file))
if line = '' then iterate
parse var line name ';' junk
if upper(name) = ustylename then
do
resp = pdm_Inform(3, "The style named: "stylename" has already been defined. Would you like to replace it?", "Cancel", "No", "Yes")
if resp = 0 then
do
call close(file)
exit_msg()
end
else if resp = 1 then
do
call close(file)
signal start
end
end
else
lines = lines || '0a'x || line
end
call close(file)
past:
if ~open(file, styledb, "w") then
exit_msg("Unable to write style to database!!")
/* append current information to lines */
lines = lines || cr || stylename'@'linecolor'@'lineweight'@'linepattern'@'linejoin'@'fillpattern
call writeln(file, lines)
call close(file)
call exit_msg("Done")
exit_msg: procedure expose units
do
parse arg message
if message ~= '' then call pdm_inform(1,message,)
call pdm_ClearStatus()
call pdm_SetUnits(units)
call pdm_AutoUpdate(1)
exit
end
separate: procedure
do
parse arg string, separator
string = replacestring(string, ' ', separator, 0)
return(string)
end